package vip.onepass.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import vip.onepass.mapper.DirTypeMapper;
import vip.onepass.mapper.OnepassConfigMapper;
import vip.onepass.mapper.PassItemMapper;
import vip.onepass.model.DirType;
import vip.onepass.model.OnepassConfig;
import vip.onepass.model.PassItem;
import vip.onepass.service.SyncService;

@Transactional
@Service
public class SyncServiceImpl implements SyncService {
	@Resource
	private OnepassConfigMapper onepassConfigMapper;
	@Resource
	private DirTypeMapper dirTypeMapper;
	@Resource
	private PassItemMapper passItemMapper;

	@Override
	public OnepassConfig findOnepassConfigByUser(String coludid) {
		
		return onepassConfigMapper.getOnepassConfig(coludid);
	}

	@Override
	public void save(OnepassConfig onepassConfig) {
		// TODO Auto-generated method stub
		onepassConfigMapper.save(onepassConfig);
	}

	@Override
	public void delConfig(String coludid) {
		// TODO Auto-generated method stub
		onepassConfigMapper.del(coludid);
	}

	@Override
	public DirType findDirByColudidAndDirid(String coludid, String dirid) {
		
		return dirTypeMapper.findByColudidAndDirid(coludid, dirid);
	}

	@Override
	public void saveDir(DirType dirType) {
		// TODO Auto-generated method stub
		dirTypeMapper.saveDir(dirType);
	}

	@Override
	public void delDir(String did) {
		// TODO Auto-generated method stub
		dirTypeMapper.del(did);
	}

	@Override
	public PassItem findPassItemByColudidAndItemid(String coludid, String itemid) {
		// TODO Auto-generated method stub
		return passItemMapper.findPassItemByColudidAndItemid(coludid,itemid);
	}

	@Override
	public void savePassItem(PassItem passItem) {
		// TODO Auto-generated method stub
		passItemMapper.savePassItem(passItem);
	}

	@Override
	public void delPassItem(String iid) {
		// TODO Auto-generated method stub
		passItemMapper.del(iid);
	}

	@Override
	public List<DirType> findAllDirByColudid(String coludid) {
		
		return dirTypeMapper.findAllByColudid(coludid);
	}

	@Override
	public List<PassItem> findPassItemByColudid(String coludid) {
		// TODO Auto-generated method stub
		return passItemMapper.findAllByColudid(coludid);
	}
	

}
